#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int a[5], n, i;

    scanf("%d", &n);
    while (n--) {
        for (i = 0; i < 4; i++) {
            scanf("%d", &a[i]);
            printf("%d ", a[i]);
        }
        if (a[0] + a[3] == a[1] + a[2]) {
            printf("%d\n", a[3] + (a[1] - a[0]));
        } else {
            printf("%d\n", a[3] * (a[3] / a[2]));
        }
    }

    return 0;
}
